home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM14.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-11  |  5KB  |  103 lines

  1. Program Exam14;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités de ChrPosLxx.                     }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1 ,
  14.   S2 : String;
  15.   I  : Integer;
  16. {  ---------------------------------------------------------------         }
  17. {  Function    ChrPosL(Str: String;Match: Char): Integer;                  }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Retourne la position de la première occurence de <Match>    }
  21. {              dans <Str> en recherchant à partir de la gauche ou 0 si     }
  22. {              <Match> n'est pas trouvé.                                   }
  23. {                                                                          }
  24. {  Usage     : Chaîne pascal.                                              }
  25. {                                                                          }
  26. {  Vitesse   : 7800/s                                                      }
  27. {                                                                          }
  28. { -------------------------------------------------------------------------}
  29.  
  30. Procedure Test1;
  31. Begin
  32.   S1 := 'abcdefghijklmnopqrstuvwxyz';
  33.   I := ChrPosL(S1,'m');
  34.   S1 := '3.14116';
  35.   I := ChrPosL(S1,'0');
  36. end;
  37.  
  38. {  ---------------------------------------------------------------         }
  39. {  Function    ChrPosLN(Str: String;Match: Char;Occur: Byte):Integer;      }
  40. {  ---------------------------------------------------------------         }
  41. {                                                                          }
  42. {  Effet     : Identique à ChrPosL, mais pour la <Occur>ème occurence.     }
  43. {                                                                          }
  44. {  Usage     : Idem.                                                       }
  45. {                                                                          }
  46. {  Vitesse   : 7800/s                                                      }
  47. {                                                                          }
  48. { -------------------------------------------------------------------------}
  49.  
  50. Procedure Test2;
  51. Begin
  52.   S1 := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
  53.   I := ChrPosLN(S1,'a',2);
  54.   S1 := '3.14116';
  55.   I := ChrPosLN(S1,'1',3);
  56. end;
  57.  
  58. {  ---------------------------------------------------------------         }
  59. {  Function    ChrPosLI(Str: String;Match: Char):Integer;                  }
  60. {  ---------------------------------------------------------------         }
  61. {                                                                          }
  62. {  Effet     : Identique à ChrPosL, mais ne tient pas compte des           }
  63. {              majuscules/minuscules.                                      }
  64. {                                                                          }
  65. {  Usage     : Idem.                                                       }
  66. {                                                                          }
  67. {  Vitesse   : 7800/s                                                      }
  68. {                                                                          }
  69. { -------------------------------------------------------------------------}
  70.  
  71. Procedure Test3;
  72. Begin
  73.   S1 := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
  74.   I := ChrPosLI(S1,'A');
  75. end;
  76.  
  77. {  ---------------------------------------------------------------         }
  78. {  Function    ChrPosLIN(Str: String;Match: Char;Occur:Byte):Integer;      }
  79. {  ---------------------------------------------------------------         }
  80. {                                                                          }
  81. {  Effet     : combinaison de ChrPosLI et de ChrPosLN.                     }
  82. {                                                                          }
  83. {  Usage     : Idem.                                                       }
  84. {                                                                          }
  85. {  Vitesse   : 7800/s                                                      }
  86. {                                                                          }
  87. { -------------------------------------------------------------------------}
  88.  
  89. Procedure Test4;
  90. Begin
  91.   S1 := 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz';
  92.   I := ChrPosLIN(S1,'A',2);
  93. end;
  94.  
  95. Begin
  96.   Test1;
  97.   Test2;
  98.   Test3;
  99.   Test4;
  100. End.
  101.  
  102. { -------------------------------------------------------------------------}
  103.